﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using TorchView.SharedStashEditor.Models;
using TorchView.GameContent.Units;
using TorchView.GameContent.Affixes;

namespace TorchView.SharedStashEditor.Helpers
{
    public class AffixEffectConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
                return null;


            List<Game.Effect> gameEffects = new List<Game.Effect>();
            Affix affix = (Affix)value;
            if (affix != null)
            {
                foreach (Effect affixEffect in affix.Effects)
                {
                    Game.Effect gameEffect = affixEffect.CreateGameEffect();
                    gameEffects.Add(gameEffect);
                }
            }

            return gameEffects;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }
}
